﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Web.Security;
using CCF20.Properties;

namespace CCF20
{
    /// <summary>
    /// Interaction logic for UserCreateWindow.xaml
    /// </summary>
    public partial class UserCreateWindow : Window
    {
        public UserCreateWindow()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            MembershipCreateStatus status;
            
            MembershipUser newUser = Membership.CreateUser(
                txtUsername.Text,
                txtPassword.Text,
                txtEmailAddress.Text,
                txtPasswordQuestion.Text,
                txtPasswordAnswer.Text,
                chkIsApproved.IsChecked.Value,
                out status);

            MessageBox.Show(status.GetUIDescription());

            if (status == MembershipCreateStatus.Success)
            {
                this.Close();
            }
        }

        
    }
}
